<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>jquery</title>
    <style>
        *{
            list-style: none;
            padding: 0;
            margin: 0;
        }
        body{
            background-color: black;
        }
        h1{
            color: white;
            text-align: center;
            margin-top: 100px;
        }
        .wrap{
            width:810px;
            height: 405px;
            border:2px solid white;
            padding: 5px;
            margin: 10px auto;
            border-radius: 10px;
        }
        .wrap li{float: left;
        padding: 5px;}
    </style>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    <script>
        $(document).ready(function () { 
          $(".wrap>ul>li").mouseenter(function () {
            //给li注册鼠标进入事件，让li都变亮
            //让li的所有兄弟透明度降低
            $(this).css("opacity","1");
            $(this).siblings().css("opacity",".4");
            $('h1').html($(this).find('img').attr("alt"));
          });
          $(".wrap").mouseleave(function () {
            //离开父盒子时，所有li亮起来
            //$(this).children().children("li");
            $(this).find('li').css("opacity", 1);
          });
        });
      </script>
</head>
<body>
    <h1>江科校园风景</h1>
    <div class="wrap">
        <ul>
            <li><img src="1.jpg" alt="学校大门"/></li>
            <li><img src="2.jpg" alt="蓝天阁美景"/></li>
            <li><img src="3.jpg" alt="图书馆"/></li>
            <li><img src="4.jpg" alt="蓝天阁美景"/></li>
            <li><img src="5.jpg" alt="行政楼"/></li>
            <li><img src="6.jpg" alt="生态园九曲桥"/></li>
        </ul>
    </div>
</body>
</html>